﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="EditNews.aspx.cs" Inherits="tamlytre.Admin.EditNews" %>
<%@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" src="../Script/jquery-1.5.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".mem_message_publish").delay(3000).fadeOut();
        });
        function CheckFileExt() {
            if ($(".cbcheck").checked == true) {
                var filePath = $('#<%=FileUploadPicture.ClientID %>').val();
                if (filePath.length == 0) {
                    alert('Xin hãy chọn một file ảnh để upload !');
                    return false;
                }
                var ext = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase();
                var validExtensions = new Array();
                validExtensions[0] = 'jpg';
                validExtensions[1] = 'jpeg';
                validExtensions[2] = 'bmp';
                validExtensions[3] = 'png';
                validExtensions[4] = 'gif';

                for (var i = 0; i < validExtensions.length; i++) {
                    if (ext == validExtensions[i])
                        return true;
                }
                alert('File bạn chọn không phải file ảnh! Xin hãy chọn một file ảnh để upload !');
                return false;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="middle_master" runat="server">
<div id="fckeditor">
         <h2>
            Soạn bài viết</h2>
        <table id="table_fck">
            <tr>
                <td class="style_td1">
                    Tiêu đề</td>
                <td>
                    <asp:TextBox ID="txtTieude" runat="server" Width="500px"></asp:TextBox>
                    </td>
            </tr>
            <tr>
                <td>
                    Chủ đề</td>
                <td>
                    <asp:DropDownList ID="DropDownListChude" runat="server" Height="20px" Width="500px">
                        
                    </asp:DropDownList>
                    </td>
                
            </tr>
            <tr>
                <td>
                    Nội dung chính</td>
                <td>
                    <FCKeditorV2:FCKeditor ID="FCKTitle" runat="server" BasePath="~/fckeditor/" 
                        Height="150px" Width="630px" ToolbarSet="EditorSimple">
                    </FCKeditorV2:FCKeditor>
                 </td>
                
            </tr>
            <tr>
                <td>
                    Nội dung</td>
                <td>
                    <FCKeditorV2:FCKeditor ID="FCKContent" runat="server" Height="1000px" Width="630px"
                        BasePath="~/fckeditor/">
                    </FCKeditorV2:FCKeditor>
                </td>
                
            </tr>
            <tr>
                <td>
                    Description</td>
                <td>
                    <asp:TextBox ID="txtTuKhoa" runat="server" Width="500px"></asp:TextBox>
                </td>

            </tr>
            <tr>
                <td>
                    Keywords</td>
                <td>
                    <asp:TextBox ID="txtkeyword" runat="server" Width="500px"></asp:TextBox>
                </td>
               
            </tr>
            <tr>
                <td>
                    Bài hay trong tháng</td>
                <td>
                    <asp:CheckBox ID="cbBaiHay" runat="server" Text="Bài hay trong tháng" />
                </td>
               
            </tr>
            <tr>
                <td>
                    Hình minh họa</td>
                <td>
                    <asp:FileUpload ID="FileUploadPicture" runat="server" />
                    <asp:CheckBox ID="cbChangePicture" CssClass="cbcheck" runat="server" Text="Đổi hình đại diện" />
                    <p><asp:Label ID="LabelMessage" runat="server" CssClass="mem_message_publish" Text=""></asp:Label></p>
                </td>
                
            </tr>
            <tr>
                <td>
                    Ghi chú hình minh họa</td>
                <td>
                    <asp:TextBox ID="txtGhichuhinh" runat="server" Width="500px"></asp:TextBox>
                </td>
                
            </tr>
            <tr>
                <td>
                    Tác giả</td>
                <td>
                    <asp:TextBox ID="txtTacGia" runat="server" Width="500px"></asp:TextBox>
                </td>
                
            </tr>
            <tr>
                <td>
                    Link</td>
                <td>
                    <asp:TextBox ID="txtLink" runat="server" Width="500px"></asp:TextBox>
                </td>
                
            </tr>
            <tr>
                <td>
                    Tiêu điểm</td>
                <td>
                    <asp:CheckBox ID="cbChonTieuDiem" runat="server" Text="Chọn làm tiêu điểm" />
                </td>
               
            </tr>
        </table>
        <div id="button_postnews">
            <asp:ImageButton ID="ibtDangbai" CssClass="btdangbai" runat="server" PostBackUrl='<%#"PostNews.aspx?id=" + Eval("idNews") %>'
                ImageUrl="~/images/ibtPostNews.png" OnClientClick="return CheckFileExt();" 
                onclick="ibtDangbai_Click" />
            <asp:ImageButton ID="ibtLuuKhongDang" CssClass="btkhongdangbai" runat="server" 
                ImageUrl="~/images/ibtSaveNews.png" OnClientClick="return CheckFileExt();" 
                onclick="ibtLuuKhongDang_Click" />
        </div><!--End button_postnews-->
    </div><!--End fckeditor-->
</asp:Content>
